package com.designpattern.softwaredesignpatternstudy.pdai.singleton;

/**
 * @author: Aster
 * @note: 懒汉式-线程不安全
 * @create: 2025-07-16 15:17
 **/
public class Singleton02 {

    private static Singleton02 instance;

    private Singleton02() {
        if (instance != null) {
            throw new RuntimeException("单例构造器禁止反射调用");
        }
    }

    public static Singleton02 getInstance() {
        if (instance == null) {
            instance = new Singleton02();
        }
        return instance;
    }
}
